<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>通知弹窗测试页面</title>
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
</head>
<body>
<div class="container">
    <h2>通知弹窗测试页面</h2>
    <p>这个页面用于测试右下角通知弹窗功能</p>
    
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading">测试通知弹窗</div>
                <div class="panel-body">
                    <button id="testNotification1" class="btn btn-primary">测试简单通知</button>
                    <button id="testNotification2" class="btn btn-info">测试带链接通知</button>
                    <button id="testNotification3" class="btn btn-success">测试多条通知</button>
                    <button id="testClearAll" class="btn btn-warning">清除所有通知</button>
                </div>
            </div>
        </div>
    </div>
</div>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/notification-popup.js}"></script>
<script th:inline="javascript">
var ctx = [[@{/}]]; 

$(document).ready(function() {
    // 初始化通知弹窗组件
    $.notificationPopup.init({
        checkInterval: 0 // 禁用定时检查，只通过按钮触发
    });
    
    // 测试简单通知
    $('#testNotification1').click(function() {
        $.notificationPopup.create({
            title: '系统通知',
            content: '这是一条简单的系统通知消息',
            autoHide: false,
            delay: 5000
        });
    });
    
    // 测试带链接通知
    $('#testNotification2').click(function() {
        $.notificationPopup.create({
            title: '业务通知',
            content: '您有新的待办任务需要处理，请及时查看',
            url: '/system/main',
            autoHide: true,
            delay: 8000
        });
    });
    
    // 测试多条通知
    $('#testNotification3').click(function() {
        $.notificationPopup.create({
            title: '通知 1',
            content: '这是第一条通知消息',
            autoHide: true,
            delay: 6000
        });
        
        setTimeout(function() {
            $.notificationPopup.create({
                title: '通知 2',
                content: '这是第二条通知消息',
                url: '/system/message/receive',
                autoHide: true,
                delay: 7000
            });
        }, 1000);
        
        setTimeout(function() {
            $.notificationPopup.create({
                title: '通知 3',
                content: '这是第三条通知消息',
                autoHide: true,
                delay: 8000
            });
        }, 2000);
    });
    
    // 清除所有通知
    $('#testClearAll').click(function() {
        $('.notification-popup').each(function() {
            var id = $(this).attr('id');
            if (id) {
                $.notificationPopup.remove(id);
            }
        });
    });
});
</script>
</body>
</html>